﻿<?php 
    if ($_POST)
    {
        $email = trim($_POST['email']);
        if (!empty($email))
        {
            $con = mysql_connect("localhost","diadieml_admin","%gh78#v");
            if (!$con)
            {
                die('Could not connect: ' . mysql_error());
            }

            mysql_select_db("diadieml_landing", $con);

            $params = array(
                "'". mysql_real_escape_string($_POST['email'])."'", "'".$_SERVER['REMOTE_ADDR']."'", ''.time()
            );
            $str = "INSERT INTO subscribe (email, ip, time_submitted) VALUES (".implode(',', $params).")";
            mysql_query($str);

            mysql_close($con);
        }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
		<meta content="utf-8" http-equiv="encoding">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="Website đầu tiên về địa điểm làm tóc, trang điểm."/>
		<meta name="keywords" content="địa điểm làm tóc, tóc, trang điểm, làm tóc" />	
		<link href="css/bootstrap.css" rel="stylesheet">
		<link href="css/bootstrap-responsive.css" rel="stylesheet">
		<link href="css/customize.css" rel="stylesheet">
		<title>Địa điểm làm tóc</title>
		
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
		<script type="text/javascript" src="js/underscore.js"></script>
		<script type="text/javascript" src="js/backbone.js"></script>
		<script type="text/javascript" src="js/bootstrap.js"></script>
		<script type="text/javascript">

		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-37149347-1']);
		  _gaq.push(['_trackPageview']);

		  (function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		  })();

		</script>
	</head>
	<body>
		<div class="container landing">
			<div class="row">
				<form class="form-inline" id="subscribe" action="index.php" method="post">
				  <input type="text" class="input-small" name="email" placeholder="Nhập email để nhận thông tin" <?php if ($_POST) echo "disabled";?>>
				  <button type="submit" class="btn-cus" <?php if ($_POST) echo "disabled";?>></button>
					<?php if ($_POST):?>
					<p class="message">
						Chúng tôi sẽ liên hệ với bạn ngay khi sản phẩm ra mắt
					</p>
					<?php endif;?>
				</form>
				<a id="fb-link" href="http://www.facebook.com/diadiemlamtoc">
					<img src="./image/facebook.png">
				</a>
			</div>
		</div>
	</body>
</html> 
